# -*- coding: utf-8 -*-
# @Time    : 2022/1/11 14:41
# @Author  : 徐翊宸
# @Email   : xyc@163.com
# @File    : page_frw.py
# @Software: PyCharm
# -*- coding: utf-8 -*-
# @Time    : 2022/1/7 14:40
# @Author  : 徐翊宸
# @Email   : xyc@163.com
# @File    : test_gzt_gzdt_frw.py
# @Software: PyCharm


from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from pages.base_page import BasePage

class FrwPage(BasePage):

    renwu_locator = (By.LINK_TEXT, "任务")
    xjrw_locator = (By.LINK_TEXT, "新建任务")
    zhuti_locator = (By.NAME, "subject")
    fuzheren_locator = (By.ID, "owner_name")
    xiangguanren_locator = (By.CSS_SELECTOR, "#about_roles_name")
    qbxz_locator = (By.CLASS_NAME, "check_all")
    ok_locator13 = (By.CSS_SELECTOR, "body > div:nth-child(13) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)")
    xzxg_locator = (By.ID, "select1")
    xzxg_input_locator = (By.ID, "module_name")
    xzlxr_locator = (By.CSS_SELECTOR, "#data2 > tr:nth-child(1) > td:nth-child(1) > input[type=radio]")
    ok_locator14 = (By.CSS_SELECTOR, "body > div:nth-child(14) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)")
    zhuangtai_locator = (By.NAME, "status")
    fstz_locator = (By.NAME, "message_alert")
    riqi_locator = (By.NAME, "due_date")
    riqi_qd_locator = (By.CSS_SELECTOR, "#xl_chrome_ext_\{4DB361DE-01F7-4376-B494-639E489D19ED\}")
    youxianji_locator = (By.NAME, "priority")
    miaosu_locator = (By.CSS_SELECTOR, "body > div.container > div.row-fluid > div > form > table > tbody > tr:nth-child(7) > td:nth-child(2) > div > div.ke-edit > iframe")
    baochun_locator = (By.CSS_SELECTOR, "body > div.container > div.row-fluid > div > form > table > tfoot > tr > td:nth-child(2) > input:nth-child(1)")

    def __int__(self, driver):
        self.driver = driver

    def renwu_click(self):
        self.driver.find_element(*self.renwu_locator).click()

    def xjrw_click(self):
        self.driver.find_element(*self.xjrw_locator).click()

    def zhuti_input(self, zhuti):
        self.driver.find_element(*self.zhuti_locator).send_keys(zhuti)

    def fuzheren_input(self, fuzheren):
        self.driver.find_element(*self.fuzheren_locator).send_keys(fuzheren)

    def xiangguanren_click(self):
        self.driver.find_element(*self.xiangguanren_locator).click()

    def qbxz_click(self):
        self.driver.find_element(*self.qbxz_locator).click()

    def ok13_click(self):
        self.driver.find_element(*self.ok_locator13).click()

    def xzxg_xz(self):
        xg_select_element = self.driver.find_element(*self.xzxg_locator)
        xg_select = Select(xg_select_element)
        xg_select.select_by_index(1)

    def xzxg_click(self):
        self.driver.find_element(*self.xzxg_input_locator).click()

    def xzlxr_click(self):
        self.driver.find_element(*self.xzlxr_locator).click()

    def ok14_click(self):
        self.driver.find_element(*self.ok_locator14).click()

    def zhuangtai_xz(self):
        zt_select_element = self.driver.find_element(*self.zhuangtai_locator)
        zt_select = Select(zt_select_element)
        zt_select.select_by_index(3)

    def riqi_input(self, riqi):
        self.driver.find_element(*self.riqi_locator).send_keys(riqi)

    def youxainji_xz(self):
        yxj_select_element = self.driver.find_element(*self.youxianji_locator)
        yxj_select = Select(yxj_select_element)
        yxj_select.select_by_index(2)

    def miaosu_input(self, miaosu):
        self.driver.find_element(*self.miaosu_locator).send_keys(miaosu)

    def baochun_click(self):
        self.driver.find_element(*self.baochun_locator).click()





